package com.sgb.kjwl.utils;

import android.util.Log;

import com.sgb.kjwl.R;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * 自动更新多种布局加载实现
 */
public class UpdateLayoutUtils {
    public static int getLayout() {
        int drawableId = R.layout.dialog_update_one;
        int lay = getRandomNumber();
        switch (lay){
            case 1:
                drawableId = R.layout.dialog_update_one;
                break;
            case 2:
                drawableId = R.layout.dialog_update_two;
                break;
            case 3:
                drawableId = R.layout.dialog_update_three;
                break;
            case 4:
                drawableId = R.layout.dialog_update_four;
                break;
            case 5:
                drawableId = R.layout.dialog_update_five;
                break;
        }
        return drawableId;
    }

    /**
     * 获取1-5的随机数
     * @return
     */
    private static int getRandomNumber() {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        Random random = new Random();
        int n = random.nextInt(list.size());
        return list.get(n);
    }
}
